package com.lv.fast.DTO;

import com.lv.fast.annotation.Phone;
import com.lv.fast.model.ExtendBean;
import com.lv.fast.valid.group.AddStrategy;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Null;
import java.util.LinkedHashSet;


/**
 * @Description
 * @Author jie.lv
 */
@Data
@ApiModel("后台用户对象")
public class SysUserDTO extends ExtendBean {

    @ApiModelProperty(value = "用户名", example = "lisi")
    @NotBlank(message = "用户名不能为空", groups = {AddStrategy.class})
    @Length(min=2, max = 50, message = "用户名长度为2-50")
    private String name;

    @ApiModelProperty(value = "真实姓名", example = "李四")
    @NotBlank(message = "真实姓名不能为空", groups = {AddStrategy.class})
    @Length(min=2, max = 50, message = "用户名长度为2-10")
    private String realName;

    @ApiModelProperty(value = "密码 md5加密", example = "e10adc3949ba59abbe56e057f20f883e")
    @NotBlank(message = "密码不能为空", groups = {AddStrategy.class})
    private String password;

    @ApiModelProperty(value = "邮箱", example = "CoderLvJie@foxmail.com")
    @NotBlank(message = "邮箱不能为空", groups = {AddStrategy.class})
    @Email(message = "邮箱格式非法")
    private String email;

    @ApiModelProperty(value = "电话号码", example = "13912345678")
    @Phone(message = "手机号码格式必须为1开头的长度为11的数字")
    private String mobile;

    @ApiModelProperty(value = "用户状态  1正常  2锁定", example = "1")
    @Null(message = "不能设置状态")
    private String status;

    private LinkedHashSet<SysRoleDTO> roles;

    private LinkedHashSet<SysMenuDTO> menus;
}
